#include "UiDownBar.h"


#ifdef MERGER_APP_TO_SHELL
	extern HINSTANCE g_SDHResModuleHandle;
#endif
UiDownBar::UiDownBar()
{
}

UiDownBar::~UiDownBar()
{
}

BOOL UiDownBar::InitUiWin(void)
{
	BOOL bRtn = FALSE;
	LoadiInterItem();
	return bRtn;
}

void UiDownBar::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate)
{
	m_VideoMainBG->Draw(hdc, prcWin, false, false);
}

int UiDownBar::OnLButtonDown(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonDown(fwKeys, xPos, yPos);

}

int UiDownBar::OnLButtonUp(UINT fwKeys, int xPos, int yPos)
{
	return UiWin::OnLButtonUp(fwKeys, xPos, yPos);
	
}

BOOL UiDownBar::InitImages()
{
	return TRUE;
}

void UiDownBar::LoadiInterItem()
{
//jdhuang 20120818
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_VideoMainBG = ImagingHelper::GetImageObject(MzGetInstanceHandle(), 1064);
#else
	m_VideoMainBG = ImagingHelper::GetImageObject(g_SDHResModuleHandle, 1064);
#endif
	RECT rtDownBar[] = {
	21, 0, 115, 94,
	157, 0, 251, 94,
	289, 0, 383, 94,
	423, 0, 517, 94,
	549, 0, 643, 94,
	685, 0, 779, 94,
	};

	m_BtnDownBar[RADIO_TUNER_BAND].SetPos(rtDownBar[RADIO_TUNER_BAND].left, rtDownBar[RADIO_TUNER_BAND].top,
				rtDownBar[RADIO_TUNER_BAND].right-rtDownBar[RADIO_TUNER_BAND].left,
				rtDownBar[RADIO_TUNER_BAND].bottom-rtDownBar[RADIO_TUNER_BAND].top);
	m_BtnDownBar[RADIO_TUNER_BAND].SetID(1700);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_BAND].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1013, true));
	m_BtnDownBar[RADIO_TUNER_BAND].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1002, true));
#else
	m_BtnDownBar[RADIO_TUNER_BAND].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1013, true));
	m_BtnDownBar[RADIO_TUNER_BAND].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1002, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_BAND]);

	m_BtnDownBar[RADIO_TUNER_ST].SetPos(rtDownBar[RADIO_TUNER_ST].left, rtDownBar[RADIO_TUNER_ST].top,
				rtDownBar[RADIO_TUNER_ST].right-rtDownBar[RADIO_TUNER_ST].left,
				rtDownBar[RADIO_TUNER_ST].bottom-rtDownBar[RADIO_TUNER_ST].top);
	m_BtnDownBar[RADIO_TUNER_ST].SetID(1701);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_ST].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1003, true));
	m_BtnDownBar[RADIO_TUNER_ST].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1004, true));
#else
	m_BtnDownBar[RADIO_TUNER_ST].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1003, true));
	m_BtnDownBar[RADIO_TUNER_ST].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1004, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_ST]);

	m_BtnDownBar[RADIO_TUNER_LOC].SetPos(rtDownBar[RADIO_TUNER_LOC].left, rtDownBar[RADIO_TUNER_LOC].top,
				rtDownBar[RADIO_TUNER_LOC].right-rtDownBar[RADIO_TUNER_LOC].left,
				rtDownBar[RADIO_TUNER_LOC].bottom-rtDownBar[RADIO_TUNER_LOC].top);
	m_BtnDownBar[RADIO_TUNER_LOC].SetID(1702);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_LOC].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1005, true));
	m_BtnDownBar[RADIO_TUNER_LOC].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1006, true));
#else
	m_BtnDownBar[RADIO_TUNER_LOC].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1005, true));
	m_BtnDownBar[RADIO_TUNER_LOC].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1006, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_LOC]);

	m_BtnDownBar[RADIO_TUNER_APS].SetPos(rtDownBar[RADIO_TUNER_APS].left, rtDownBar[RADIO_TUNER_APS].top,
				rtDownBar[RADIO_TUNER_APS].right-rtDownBar[RADIO_TUNER_APS].left,
				rtDownBar[RADIO_TUNER_APS].bottom-rtDownBar[RADIO_TUNER_APS].top);
	m_BtnDownBar[RADIO_TUNER_APS].SetID(1703);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_APS].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1007, true));
	m_BtnDownBar[RADIO_TUNER_APS].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1008, true));
#else
	m_BtnDownBar[RADIO_TUNER_APS].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1007, true));
	m_BtnDownBar[RADIO_TUNER_APS].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1008, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_APS]);

	m_BtnDownBar[RADIO_TUNER_UP].SetPos(rtDownBar[RADIO_TUNER_UP].left, rtDownBar[RADIO_TUNER_UP].top,
				rtDownBar[RADIO_TUNER_UP].right-rtDownBar[RADIO_TUNER_UP].left,
				rtDownBar[RADIO_TUNER_UP].bottom-rtDownBar[RADIO_TUNER_UP].top);
	m_BtnDownBar[RADIO_TUNER_UP].SetID(1704);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_UP].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1009, true));
	m_BtnDownBar[RADIO_TUNER_UP].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1010, true));
#else
	m_BtnDownBar[RADIO_TUNER_UP].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1009, true));
	m_BtnDownBar[RADIO_TUNER_UP].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1010, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_UP]);

	m_BtnDownBar[RADIO_TUNER_DOWN].SetPos(rtDownBar[RADIO_TUNER_DOWN].left, rtDownBar[RADIO_TUNER_DOWN].top,
				rtDownBar[RADIO_TUNER_DOWN].right-rtDownBar[RADIO_TUNER_DOWN].left,
				rtDownBar[RADIO_TUNER_DOWN].bottom-rtDownBar[RADIO_TUNER_DOWN].top);
	m_BtnDownBar[RADIO_TUNER_DOWN].SetID(1705);
//jdhuang 20120928
#ifndef MERGER_APP_TO_SHELL
	m_BtnDownBar[RADIO_TUNER_DOWN].SetNormalImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1011, true));
	m_BtnDownBar[RADIO_TUNER_DOWN].SetPressedImage(ImagingHelper::GetImageObject(MzGetInstanceHandle(),1012, true));
#else
	m_BtnDownBar[RADIO_TUNER_DOWN].SetNormalImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1011, true));
	m_BtnDownBar[RADIO_TUNER_DOWN].SetPressedImage(ImagingHelper::GetImageObject(g_SDHResModuleHandle,1012, true));
#endif
	AddChild(&m_BtnDownBar[RADIO_TUNER_DOWN]);


}
void UiDownBar::DeleteImages()
{
	m_VideoMainBG->UnloadImage();
}